package ink.yql.dao;

import ink.yql.model.Returns;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author YQL
 */
@Mapper
public interface ReturnsDao {

    @Select("select * from returns where pid = #{pid} ")
    List<Returns> getByPid(@Param("pid") Integer pid);

    @Select("select * from returns where rid = #{rid} ")
    Returns getByRid(@Param("rid") Integer rid);

    @Insert("insert into returns (pid,rmoney,,rtitle,rdescription,rgiveTime,rgiveType," +
              "rfreeShippin,rearlyBird,rstartTime,rendTime,rremark,risRemark) values" +
              "(#{pid} ,#{rmoney},#{rtitle} ,#{rdescription} ,#{rgiveTime} ,#{rgiveType} " +
              ",#{rfreeShippin} ,#{rearlyBird} ,#{rstartTime},#{rendTime} ,#{rremark} ,#{risRemark} )")
    Integer addOne(Returns returns);

    @Update("update returns (pid,rmoney,,rtitle,rdescription,rgiveTime,rgiveType," +
              "rfreeShippin,rearlyBird,rstartTime,rendTime,rremark,risRemark) values" +
              "(#{pid} ,#{rmoney},#{rtitle} ,#{rdescription} ,#{rgiveTime} ,#{rgiveType} " +
              ",#{rfreeShippin} ,#{rearlyBird} ,#{rstartTime},#{rendTime} ,#{rremark} ,#{risRemark} )where rid = #{rid} ")
    Integer update(Returns returns);

    @Delete("delete from returns where pid = #{pid}")
    Integer deleteByPid(@Param("pid") Integer pid);

    @Delete("delete from returns where rid = #{rid}")
    Integer deleteByRid(@Param("rid") Integer rid);

}
